﻿using System;
using Mono.Cecil;
using Mono.Cecil.Cil;
using ProjScan.ScanRule.Attr;
using ProjScan.Submodules.CS_Check;

namespace ProjScan.ScanRule.CodeAnalysis
{
	// Token: 0x02000223 RID: 547
	[CSCheckRuleAttr]
	internal class TagCompare : InstructionRuleImpBase
	{
		// Token: 0x06000F70 RID: 3952 RVA: 0x00044AAC File Offset: 0x00042CAC
		protected override bool AnalyzeInst(MethodDefinition method, Instruction inst, ref LineMapping failedInfo)
		{
			bool flag = inst.OpCode == OpCodes.Call || inst.OpCode == OpCodes.Callvirt;
			if (flag)
			{
				MethodReference methodReference = (MethodReference)inst.Operand;
				bool flag2 = methodReference.Name == "get_tag" && methodReference.DeclaringType != null && (methodReference.DeclaringType.Name == "Component" || methodReference.DeclaringType.Name == "GameObject");
				if (flag2)
				{
					failedInfo.Merge(LineMapping.GetMapping(method, inst));
					return false;
				}
			}
			return true;
		}
	}
}
